<template>
	<view class="page">
		<!-- 顶部切换 -->
		<view class="tabsBox" id="main1">
			<!-- <u-tabs :list="tabsList" @click="switchTabs" :activeStyle="{ color: '#14AAA8 ' }" itemStyle="{width:365rpx;height:100rpx}"
				lineColor="#14AAA8 "></u-tabs> -->
			<!-- 1 新机  2 旧机 -->
			<view :class="[new_machine == 1 ? 'tabItemClass' : '']" class="tabItem" @click="switchTabs(1)">
				新机
				<view class="activeBox" v-show="new_machine == 1">
				</view>
			</view>
			<view :class="[new_machine == 2 ? 'tabItemClass' : '']" class="tabItem" @click="switchTabs(2)">
				旧机
				<view class="activeBox" v-show="new_machine == 2">
				</view>
			</view>
		</view>
		<!-- 主体 -->
		<!-- 测试 -->
		<scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'">
			<view class="oldBox">
				<view class="mainBox">
					<view class="title">
						商品信息
					</view>
					<!-- 商家 -->
					<view class="">
						<picker @change="changeMerchant($event)" data-info="商家" :value="merchantVal" :range="merchantList"
							:range-key="'name'">
							<view class="infoItem">
								<view class="">
									商家：
								</view>
								<view class="rightText">
									{{ merchantName }}
								</view>
							</view>
						</picker>
					</view>
					<!-- 品牌 -->
					<view class="">
						<picker @change="changeBrand($event)" data-info="品牌" :value="brandVal" :range="brandCol"
							:range-key="'name'">
							<view class="infoItem">
								<view class="">
									品牌：
								</view>
								<view class="rightText">
									{{ brandName }}
								</view>
							</view>
						</picker>
					</view>
					<!-- 型号 -->
					<view class="">
						<picker @change="changeModel($event)" data-info="型号" :value="modelVal" :range="modelCol"
							:range-key="'model'" :disabled="brandName == '请选择品牌'">
							<view class="infoItem">
								<view class="">
									型号
								</view>
								<view class="rightText">
									{{ modelName }}
								</view>
							</view>
						</picker>
					</view>
					<!-- 内存 -->
					<view class="">
						<picker @change="changeMemory($event)" data-info="内存" :value="memoryVal" :range="memoryCol"
							:range-key="'memory'" :disabled="brandName == '请选择品牌'">
							<view class="infoItem">
								<view class="">
									内存
								</view>
								<view class="rightText">
									{{ memoryName }}
								</view>
							</view>
						</picker>
					</view>
					<!-- 颜色 -->
					<view class="">
						<picker @change="changeColor($event)" data-info="颜色" :value="colorVal" :range="colorCol"
							:range-key="'color'" :disabled="brandName == '请选择品牌'">
							<view class="infoItem">
								<view class="">
									颜色
								</view>
								<view class="rightText">
									{{ colorName }}
								</view>
							</view>
						</picker>
					</view>
				</view>
				<view class="mainBox" style="450rpx" v-if="modelName !== '请选择型号'">
					<view class="title">
						订单金额
					</view>
					<view class="">
						<view class="infoItem">
							<view class="">
								售价
							</view>
							<view class="" style="display: flex;">
								<input type="number" placeholder="请输入售价" v-model="price" @blur="getBillData"
									style="font-size: 25rpx;width: 150rpx;background-color: #f6f6f6;" />
							</view>
							<view class="guideText">
								指导价：
							</view>
							<span style="color: red;">￥{{ reallyPrice }}</span>
						</view>
					</view>
				</view>
				<view class="mainBox" v-if="modelName !== '请选择型号'">
					<!-- 首付金额 -->
					<view class="downpayBox">
						<view class="" style="padding: 0 0.2rem;box-sizing: border-box;width: 100%;">
							<view class="" style="margin: 0.2rem 0;font-size: 30rpx;">
								首期金额：{{ down_payment_ratio }} %
							</view>
							<view class="" style="width: 100%;">
								<u-slider v-model="down_payment_ratio" step="5" min="30" max="80"
									@input='changenDownpay'></u-slider>
							</view>
						</view>
					</view>
					<view class="downpayBox">
						<view class="" style="padding: 0 0.2rem;box-sizing: border-box;width: 100%;">
							<view class="" style="margin: 0.2rem 0;font-size: 30rpx;">
								租赁期数：
							</view>
							<view class="" style="width: 100%;display: flex;flex-wrap: wrap;">
								<view class="" v-for="(item, index) in downpayColMonth" :key="index">
									<view :class="['downpayItem', active2 == index ? 'activeItem' : '']"
										@click="changenDownZulin(item, index)">
										{{ item.number_of_periods }}
									</view>
								</view>
							</view>
						</view>
					</view>

					<!-- 订单总额 -->
					<view class="" v-if="active2 !== -1">
						<!-- 						<view class="priceItem">
							<view class="Pitem">
								<view class="">
									订单总额：
								</view>
								<view class="">
									<input type="number" placeholder="请输入售价" v-model="price" @blur="blurPrice"
										style="font-size: 25rpx;width: 150rpx;background-color: #f6f6f6;" />
								</view>
							</view>
						</view> -->
						<view class="priceItem">
							<view class="Pitem">
								<view class="">
									总金额：
								</view>
								<view class="">
									￥{{ totlePrice }}
								</view>
							</view>
						</view>
						<view class="priceItem">
							<view class="Pitem">
								<view class="">
									会员费用：
								</view>
								<view class="">
									<!-- ￥{{billData[0].price}} -->
									￥{{ vipFirst }}
								</view>
							</view>
						</view>
					</view>
				</view>
				<view class="mainBox" style="margin-bottom: 200rpx;" v-if="active2 !== -1">
					<view class="title">
						账单明细：
					</view>
					<view class="" v-for="(item, index) in billData" :key="index">
						<view class="Pitem1">
							<view class="Pitem1Time">
								<span>{{ item.name }}</span>
								<span>{{ item.time }}</span>
							</view>
							<view class="">
								￥{{ ((item.price) * 1).toFixed(2) }}
							</view>
						</view>
					</view>
				</view>


			</view>
		</scroll-view>
		<!-- 底部 下一页 -->
		<view class="botBox" id="botBox">
			<button v-if="!token" class="nextPage" @getAuthorize="onGetAuthorize" open-type="getAuthorize"
				scope="phoneNumber" onError="handleAuthError">
				下一页
			</button>
			<view class="nextPage" @click="nextStep" v-else>
				下一页
			</view>



			<!-- v-if="new_machine == 1" -->
		</view>
	</view>
</template>
<script>
import { getAlipayAuthCode } from '@/utils/alipay';
import {
	pay
} from '@/common/pay.js';
import baseurl from "@/config.js"
export default {
	data() {
		return {
			yieldBbj: {},
			baseurl: "",
			tabItemActive: false,
			token: '',
			// 以租代购标识  0 正常  4 以租代购
			car_lease: 1,
			// 品牌参数
			category_id: '',
			product_id: '',
			// 新旧机区别 0新机 1旧机
			new_machine: 1,
			// 商品指导价
			guide_price: '',
			// 商品售价
			ceiling_price: '',
			// tabs数据
			tabsList: [{
				name: '新机',
				value: 1
			},
			{
				name: '旧机',
				value: 2
			},
			],
			// 品牌数据
			brandCol: [],
			brandVal: 0,

			brandName: '请选择品牌',
			// 型号数据
			modelCol: [],
			modelVal: 0,
			modelName: '请选择型号',
			// 内存数据
			memoryCol: [],
			memoryVal: 0,
			memoryName: '请选择内存',
			// 颜色
			colorCol: [],
			colorVal: 0,
			colorName: '请选择颜色',
			// 成色
			chengseCol: [],
			chengseVal: 0,
			chengseName: '请选择成色',
			// 首付金额数据
			downpayCol: [],
			downpayVal: 0,
			downpayName: '请选择购机优惠',
			// 账单明细
			billData: [],
			// 售价
			price: '',
			// 订单总额
			totlePrice: '',
			vipFirst: "",



			//原价
			reallyPrice: '',
			// 租机费用
			// service: '',
			// 首单配置比例
			down_payment_ratio: '30',
			down_payment_ratio_shou: '',
			// 末期自定义期数
			late: '',
			// 末期自定义期数金额
			rent: '',
			// 花呗总额度
			total_credit_limit_of_huabei: '',
			// 芝麻信用分
			sesame_credit_score: "",
			// 首付配置id
			down_payment: '',
			product_sku_id: '',
			old_and_new: '',
			active1: -1,
			// 传递下单页面的新旧机参数 0 新机 1旧机
			old_and_new: '',
			// 接受商品规格
			skuData: [],
			// 不用内存不同的价格
			sku: [],
			scrollviewHigh: 0,
			//首期金额
			showFirstMoney: false,
			//账单明细
			showCountMeau: false,
			zulinMonth: '',
			active2: -1,
			downpayColMonth: [{
				number_of_periods: '3期',
				key: 3
			},
			{
				number_of_periods: '6期',
				key: 6
			},
			{
				number_of_periods: '9期',
				key: 9
			},
			{
				number_of_periods: '12期',
				key: 12
			}
			],
			submitInfo: false,

			spec_sku_id: '',
			yield: "",
			merchantList: [],
			merchantVal: 1,
			merchantName: '请选择商家',
		}
	},
	created() {
		this.getMerchantList()
		if (uni.getStorageSync('submitInfo') != '') {
			this.submitInfo = uni.getStorageSync('submitInfo')
		}
		this.getBrandData()
		if (uni.getStorageSync('token')) {
			this.token = uni.getStorageSync('token')
		}
		this.baseurl = baseurl.app_url;
		this.init()
		// this.merchantName = this.merchantList[0].name
	},
	// watch: {
	// 	price: {
	// 		deep: true,
	// 		handler: function(n, o) {
	// 			if (n != o && o !== undefined) {
	// 				this.break()
	// 			}
	// 		},
	// 		immediate: true
	// 	}
	// },
	methods: {

		changeMerchant(e) {
			if (e) {
				this.merchantVal = e.detail.value
				this.merchantName = this.merchantList[e.detail.value].name
			} else {
				this.merchantVal = 0
			}
			this.getBrandData()
		},
		getMerchantList() {
			let self = this
			self._post('supplier.index/list', {
				sortType: 'all'
			}, function (res) {
				let list = res.data.list.data
				// 清空旧数据
				self.merchantList = []
				list.forEach(item => {
					self.merchantList.push({
						name: item.name,
						value: item.shop_supplier_id
					})
				})

				// ✅ 加载完成后赋值第一个商家名称
				if (self.merchantList.length > 0) {
					self.merchantVal = 0
					self.merchantName = self.merchantList[0].name
				}

				console.log(self.merchantList, '-------merchantList')
			})
		},
		processPercentageField(value) {
			const containsPercentageRegex = /%|%%|百分之\d+/;
			if (containsPercentageRegex.test(value)) {
				return value;
			}
			return value + '%';
		},
		/*初始化*/
		init() {
			let _this = this;
			uni.getSystemInfo({
				success(res) {
					_this.phoneHeight = res.windowHeight;
					// 计算组件的高度
					let view = uni.createSelectorQuery().select('#botBox');
					let view1 = uni.createSelectorQuery().select('#main1');
					let h1 = ''
					view.boundingClientRect(data => {
						let h = _this.phoneHeight - data.height;
						h1 = h
					}).exec();
					view1.boundingClientRect(data => {
						_this.scrollviewHigh = h1 - data.height;
					}).exec();
				}
			});
		},
		blurPrice() {
			let n = (this.price * 1).toFixed(2)
			if (Number(n) > Number(this.guide_price) && this.guide_price) {
				uni.showToast({
					title: '售价需小于等于最高售价'
				});
			}
		},
		// 切换新机旧机页面
		switchTabs(val) {
			// 1新机  2旧机
			// this.new_machine = val.value
			this.product_sku_id = ''
			this.new_machine = val
			this.modelCol = []
			this.modelVal = 0
			this.modelName = '请选择型号'
			this.memoryCol = []
			this.memoryVal = 0
			this.memoryName = '请选择内存'
			this.colorCol = []
			this.colorVal = 0
			this.colorName = '请选择颜色'
			this.chengseVal = 0
			this.chengseCol = []
			this.chengseName = '请选择成色'
			this.price = ''
			this.guide_price = ''
			this.brandCol = []
			this.brandVal = 0
			this.brandName = '请选择品牌'
			this.billData = []
			this.active1 = -1
			this.active2 = -1
			this.showCountMeau = false
		},
		// 获取品牌数据
		getBrandData() {
			let self = this;
			self._post('product.category/get_car_lease', {
				app_id: 10001,
				// 新旧机区分  1新机  2旧机
				old_and_new: self.new_machine
			},
				res => {
					console.log(res, '------------------品牌');
					self.brandCol = res.data.list_data;
					self.changeBrand()
				})
		},
		// 选择品牌类型
		changeBrand(e) {
			if (e) {
				this.brandVal = e.detail.value
			} else {
				this.brandVal = 0
			}
			// 切换了品牌类型
			if (this.brandName !== '请选择品牌' && this.brandCol[this.brandVal].name !== this.brandName) {
				this.modelCol = []
				this.modelVal = 0
				this.modelName = '请选择型号'
				this.memoryCol = []
				this.memoryVal = 0
				this.memoryName = '请选择内存'
				this.colorCol = []
				this.colorVal = 0
				this.colorName = '请选择颜色'
				this.chengseVal = 0
				this.chengseCol = []
				this.chengseName = '请选择成色'
				this.billData = []
				this.active2 = -1
				this.showCountMeau = false
			}
			this.brandName = this.brandCol[this.brandVal].name
			this.category_id = this.brandCol[this.brandVal].category_id
			// 获取型号数据
			this.getModelData()
		},
		// 选择型号
		changeModel(e) {
			console.log(e, '=-=-=-=-=-型号');
			if (e) {
				this.modelVal = e.detail.value
			} else {
				this.modelVal = 0
			}

			let tempModelName = "";
			if (this.modelCol && this.modelVal && this.modelCol[this.modelVal].model) {
				tempModelName = this.modelCol[this.modelVal].model;
			}

			let temp_product_id = 1
			if (this.modelCol && this.modelVal && this.modelCol[this.modelVal].id) {
				temp_product_id = this.modelCol[this.modelVal].id;
			}

			this.modelName = tempModelName;// this.modelCol[this.modelVal].model;
			this.product_id = temp_product_id;//this.modelCol[this.modelVal].id;
			this.memoryCol = []
			this.memoryVal = 0
			this.memoryName = '请选择内存'
			this.colorCol = []
			this.colorVal = 0
			this.colorName = '请选择颜色'
			this.chengseVal = 0
			this.chengseCol = []
			this.chengseName = '请选择成色'
			this.billData = []
			this.active2 = -1
			this.showCountMeau = false
			// 获取内存信息
			this.getMemoryData()
		},
		// 获取商家信息
		// getMerchantList() {
		// 	let self = this
		// 	self._post('supplier.index/list', {
		// 		sortType: 'all'
		// 	}, function (res) {
		// 		let list = res.data.list.data
		// 		list.forEach(item => {
		// 			self.merchantList.push({
		// 				name: item.name,
		// 				value: item.shop_supplier_id
		// 			})
		// 		})
		// 		console.log(self.merchantList, '-------merchantList');
		// 	})
		// },
		// 获取型号数据
		getModelData() {
			let self = this
			// console.log(self.merchantList[self.merchantVal].value, 'sssssss');
			let merchantVal = this.merchantVal;
			let temp_shop_supplier_id = 1001;
			if (this.merchantList[merchantVal] && this.merchantList[merchantVal].value) {
				temp_shop_supplier_id = this.merchantList[merchantVal].value;
			}

			self._post('product.product/lists', {
				app_id: 10001,
				category_id: self.category_id,
				car_lease: self.car_lease,
				shop_supplier_id: temp_shop_supplier_id,
				list_rows: 200
			},
				res => {
					console.log(res, '-------------型号数据');
					let data = res.data.list.data
					self.modelCol = []
					for (var i = 0; i < data.length; i++) {
						self.modelCol.push({
							id: data[i].product_id,
							model: data[i].product_desc
						})
					}
					self.changeModel()
				})
		},

		// 选择内存
		changeMemory(e) {
			this.active2 = -1
			this.showCountMeau = false

			if (e) {
				this.memoryVal = e.detail.value
			} else {
				this.memoryVal = 0
			}
			console.log(this.memoryCol, this.memoryVal, '====1111')
			this.memoryName = this.memoryCol[this.memoryVal].memory
			let arr
			arr = this.product_sku_id.split('_')
			if (arr.length >= 1 && arr[0] !== '') {
				arr[0] = this.memoryCol[this.memoryVal].id
				this.product_sku_id = arr.join('_')
			} else {
				this.product_sku_id = this.memoryCol[this.memoryVal].id + '_'
			}
			this.getGuidePprice()
		},
		// 获取内存数据
		getMemoryData() {
			let self = this
			self._post('product.product/detail', {
				app_id: 10001,
				product_id: self.product_id,
				url: '',
				visitcode: ''
			}, res => {
				console.log(res, '--=================内存');
				// 内存规格相关数据
				self.skuData = res.data.detail.sku
				self.yieldBbj = JSON.parse(res.data.detail.yield)
				// self.reallyPrice = res.data.detail.product_sku.guide_price
				// console.log(self.reallyPrice, '===============付款总价');
				// 首付配置
				// 具体规格参数
				let data = res.data.specData.spec_attr;
				for (let i = 0; i < data.length; i++) {
					// 内存数据
					if (data[i].group_name == '内存') {
						let info = data[i].spec_items;
						self.memoryCol = []
						for (let s = 0; s < info.length; s++) {
							self.memoryCol.push({
								id: info[s].item_id,
								memory: info[s].spec_value
							})
						}
					}
					// 颜色数据
					if (data[i].group_name == '颜色') {
						let info = data[i].spec_items;
						self.colorCol = []
						for (let s = 0; s < info.length; s++) {
							self.colorCol.push({
								id: info[s].item_id,
								color: info[s].spec_value
							})
						}
					}
				}
				self.changeMemory()
				self.changeColor()

			})
		},
		// 选择颜色
		async changeColor(e) {
			this.active2 = -1
			this.showCountMeau = false

			console.log(e, '------------------颜色数据')
			if (e) {
				this.colorVal = e.detail.value
			} else {
				this.colorVal = 0
			}
			this.colorName = this.colorCol[this.colorVal].color
			console.log(this.product_sku_id)
			console.log(this.product_sku_id.split('_'))
			let arr
			arr = this.product_sku_id.split('_')
			if (arr.length >= 2) {
				arr[1] = this.colorCol[this.colorVal].id
				this.product_sku_id = arr.join('_')
			} else {
				this.product_sku_id = this.product_sku_id + this.colorCol[this.colorVal].id
			}

			this.sku = this.skuData[this.colorVal]
			// 商品指导价
			this.guide_price = this.sku.guide_price
			// 商品售价
			this.ceiling_price = this.sku.ceiling_price
			await this.getGuidePprice()
		},

		// 指导价
		getGuidePprice() {
			console.log(this.product_sku_id, 'spec_sku_id')
			this.skuData.forEach(item => {
				if (this.product_sku_id == item.spec_sku_id) {
					this.reallyPrice = item.official_website_price
					// this.yield = item.yield
				}
			})
		},
		//选择期数
		changenDownZulin(e, index) {
			if (this.price == '') {
				uni.showToast({
					title: '请填写售价'
				});
			} else {
				console.log(e)
				this.active2 = index
				this.billData = []
				this.zulinMonth = e.key
				console.log(this.yieldBbj, e.key)
				switch (e.key) {
					case 3:
						this.yield = this.yieldBbj.ID3
						break;
					case 6:
						this.yield = this.yieldBbj.ID6
						break;
					case 9:
						this.yield = this.yieldBbj.ID9
						break;
					case 12:
						this.yield = this.yieldBbj.ID12
						break;
					default:
						break;
				}
				console.log(this.yield)
				this.getBillData()
			}
		},

		// 选择首付金额
		changenDownpay() {
			// console.log(this.down_payment_ratio)
			// this.active2 = -1
			if (Number(this.price) == 0) {
				this.active2 = -1
				return
			}
			if (this.zulinMonth == '') {
				this.active2 = -1
				return
			}
			this.getBillData()
		},
		calculate(totalRent, installments) {
			// 使用更精确的计算方法
			const amount = parseFloat((totalRent / installments).toFixed(4));
			const baseAmount = Math.floor(amount * 100) / 100; // 保留两位小数
			// 计算余数
			const remainder = parseFloat((totalRent - baseAmount * installments).toFixed(2));
			let results = Array(installments).fill(baseAmount);
			let hasRemainder = remainder > 0;
			if (hasRemainder) {
				results[results.length - 1] = parseFloat((results[results.length - 1] + remainder)
					.toFixed(2));
			}
			let sum = results.reduce((acc, curr) => acc + parseFloat(curr), 0);
			// console.log(results, 'results', sum)
			return results
		},
		// 获取账单明细数据
		getBillData() {
			if (Number(this.price) == 0) {
				uni.showToast({
					title: "请填写售价！",
					duration: 1000,
					position: 200,
				})
				this.active2 = -1
				return
			}
			if (this.yield <= 0) {
				uni.showToast({
					title: "该商品规格未配置齐全，请重新选择！",
					duration: 1000,
					position: 200,
				})
				this.active2 = -1
				return
			}
			this.vipFirst = (Number(this.price) * (Number(this.down_payment_ratio) / 100)).toFixed(2)
			// let syl = ((Number(this.price) - Number(this.vipFirst)) * Number(this.yield)).toFixed(2)
			// this.totlePrice = (Number(syl)).toFixed(2)
			this.totlePrice = ((Number(this.price) - Number(this.vipFirst)) * Number(this.yield)).toFixed(2)
			let priceList = this.calculate(this.totlePrice, this.zulinMonth)
			for (let i = 0; i < this.zulinMonth; i++) {
				let obj2 = {
					name: '第' + (i + 1) + '期',
					price: priceList[i],
					time: this.getRecentMonth_Date(i)
				}
				// console.log(obj2, '------------2')
				this.billData[i] = obj2
			}
		},
		getRecentMonth_Date(n) {
			let result = '';
			const datenow = new Date();
			const dateend =
				datenow.getFullYear().toString() +
				'-' +
				(datenow.getMonth() + 1).toString() +
				'-' +
				datenow.getDate().toString();
			datenow.setMonth(datenow.getMonth() + n + 1);
			let dyear = datenow.getFullYear();
			let dmonth = datenow.getMonth() + 1;
			dmonth = dmonth < 10 ? 0 + dmonth : dmonth;
			let dday = datenow.getDate();
			const datestart =
				dyear.toString() + '-' + dmonth.toString() + '-' + dday.toString();
			result += datestart
			return result;
		},
		// 下一步 跳转页面
		nextStep() {
			if (this.merchantName == '请选择商家') {
				uni.showToast({
					title: "请填写商家信息！",
					duration: 1000,
					position: 200,
				})
				return
			}
			if (this.brandName == '请选择品牌') {
				uni.showToast({
					title: "请填写商品信息！",
					duration: 1000,
					position: 200,
				})
				return
			}
			if (this.active2 == -1) {
				uni.showToast({
					title: "此规格商家尚未配置，请切换型号！",
					duration: 2000,
					position: 200,
				})
				return
			}

			if (this.new_machine == 1) {
				this.old_and_new = 0
			} else if (this.new_machine == 2) {
				this.old_and_new = 1
			}
			console.log(this.product_id, 'this.product_id')
			console.log(this.product_sku_id, 'this.product_sku_id')
			console.log(this.price, 'this.price')
			console.log(this.zulinMonth, 'this.zulinMonth')
			console.log(this.down_payment_ratio, 'this.down_payment_ratio')
			uni.navigateTo({
				url: '/pages/order/lease-submit?price=' + this.price + '&car_lease=' + this.car_lease +
					'&product_id=' + this.product_id + '&product_num=' + 1 + '&product_sku_id=' +
					this.product_sku_id + '&old_and_new=' + this.old_and_new +
					'&new_machine=' + this.new_machine + '&zhouqi=' + this.zulinMonth + '&down_payment_ratio=' + this.down_payment_ratio

			})
		},


		// 支付宝登录
		async onGetAuthorize() {
			let tguser_id = uni.getStorageSync('tguser_id');
			try {
				const { authCode, userInfo } = await getAlipayAuthCode('phone');
				this._post('user.usermp/mnpAlipayAuthLogin', {
					code: authCode,
					content: userInfo,
					tguser_id: tguser_id
				}, res => {
					if (res.data.code == 0) {
						uni.showToast({
							title: res.data.msg
						});
					} else {
						this.token = res.data.data
							.token
						uni.setStorageSync('token', res
							.data.data
							.token);
						uni.setStorageSync('user_id',
							res
								.data.data
								.user_id);
						uni.showToast({
							title: '登录成功'
						});
						this.nextStep()
					}
				}
				)
			} catch (error) {
				console.error("登录失败", error);
			}
		},
	},

	mounted() { },
	onLoad() { },
}
</script>

<style lang="less">
.zhibao {
	padding: 20rpx 40rpx;
	background-color: #fff;

	.zhibao_item {
		font-size: 32rpx;
		padding: 30rpx 20rpx;
		display: flex;
		margin-bottom: 2rpx;
		border-radius: 12rpx;
		background-color: #f3f3f3;

		.zhibao_title {
			width: 200rpx;
			margin-right: 6rpx;
		}
	}

}


.page {
	background-color: #f3f3f3;
}

.downpayBox {
	display: flex;
	justify-content: flex-start;
	flex-wrap: wrap;
}

.downpayItem {
	background-color: #eef7fe;
	width: 180rpx;
	height: 70rpx;
	color: #14AAA8;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30rpx;
	margin-right: 15rpx;
	margin-bottom: 15rpx;
}

.activeItem {
	background-color: #14AAA8;
	width: 180rpx;
	height: 70rpx;
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 30rpx;
	margin-right: 15rpx;
	margin-bottom: 15rpx;
}

.tabsBox {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 80rpx;
}

.tabsBox .tabItem {
	flex: 1;
	height: 100rpx;
	border-radius: 0px 0px 0px 0px;
	opacity: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32rpx;
	flex-direction: column;
	position: relative;
	background-color: #ffffff;
}

.tabItemClass {
	color: #14AAA8;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
}

.activeBox {
	width: 32rpx;
	height: 6rpx;
	opacity: 1;
	background-color: #14AAA8;
	position: absolute;
	bottom: 0;
}

.oldBox {}

.mainBox {
	background-color: #ffffff;
	margin: 30rpx 20rpx;
	padding: 30rpx 30rpx;
}

.zhibaoTime {
	width: 136rpx;
	height: 80rpx;
	background: #14AAA8;
	border-radius: 12rpx;
	opacity: 1;
	font-weight: 600;
	color: #FFFFFF;
	font-size: 32rpx;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tipBox {
	width: 662rpx;
	height: 208rpx;
	background-color: #FFF7E8;
	border-radius: 15rpx;
}

.tipTop {
	display: flex;
	padding-top: 10rpx;
}

.tipBot {
	width: 500rpx;
	font-size: 28rpx;
	font-weight: 400;
	color: #FF7D00;
	align-items: center;
	margin: 20rpx auto;
}

.tipBot1 {
	width: 300rpx;
	font-size: 28rpx;
	font-weight: 400;
	color: #FF7D00;
	align-items: center;
	margin: 20rpx auto;
}

.lefticon {
	width: 120rpx;
	height: 48rpx;
}

.lefticon image {
	width: 120rpx;
	height: 48rpx;
}

.title {
	height: 50rpx;
	font-size: 28rpx;
	font-weight: 500;
	color: rgba(0, 0, 0, 0.9);
	line-height: 44rpx;
}

.infoItem {
	width: 95%;
	height: 90rpx;
	font-size: 30rpx;
	border-radius: 10rpx;
	padding: 0 20rpx;
	background-color: #f6f6f6;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 12rpx;
	border-bottom: 2rpx solid #f6f6f6;
}

.infoItem1 {
	width: 95%;
	font-size: 30rpx;
	border-radius: 10rpx;
	padding: 0 20rpx;
	background-color: #f6f6f6;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 12rpx;
	border-bottom: 2rpx solid #f6f6f6;
}

.leftText {
	font-size: 32rpx;
	font-weight: 530;
	color: rgba(0, 0, 0, 0.9);
	line-height: 48rpx;
	width: 170rpx;
}

.guideText {
	font-size: 30rpx;
	font-weight: 400;
	color: rgba(0, 0, 0, 0.9);
	line-height: 40rpx;
}

.rightText {
	font-size: 32rpx;
	font-weight: 400;
	color: rgba(0, 0, 0, 0.4);
	line-height: 48rpx;
}

.priceItem {
	width: 100%;
	height: 70rpx;
	border-radius: 10rpx;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 12rpx;
}

.Pitem {
	background-color: #f6f6f6;
	flex: 1;
	border-radius: 10rpx;
	height: 90rpx;
	line-height: 70rpx;
	padding: 0 30rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 15rpx;
}

.Pitem1 {
	background-color: #f6f6f6;
	flex: 1;
	border-radius: 10rpx;
	height: 100rpx;
	line-height: 70rpx;
	padding: 0 30rpx;
	display: flex;
	justify-content: space-between;
	margin-top: 15rpx;
	font-size: 25rpx;
	align-items: center;
}

.Pitem1Time {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
}

.tip {
	color: #EF3723;
	font-size: 21rpx;
	margin: 22rpx;
}

.botBox {
	width: 100%;
	height: 180rpx;
	background-color: #ffffff;
	position: fixed;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nextPage {
	width: 90%;
	// border-radius: 40rpx;
	height: 80rpx;
	background-color: #3FD2CC;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
}
</style>